Câu ví dụ
- Gender is coded as a dummy variable (Male=0, Female=1).
Biến giới tính là biến dummy có giá trị 0 (nữ), 1 (nam) - effect of a dummy variable:
Kết quả Dummy Variable: - Effect of a dummy variable:
Kết quả Dummy Variable: - Here, we introduce a dummy variable y to hold a copy of the target column before removing it from the DataFrame.
Ở đây, chúng tôi giới thiệu một biến giả y để giữ một bản sao của cột mục tiêu trước khi xóa nó khỏi DataFrame. - And pandas has a built-in function called get dummies, which will convert the values of a single column into multiple columns of 0's and 1's, indicating the presence of a dummy variable.
Và hàm panda có một chức năng gọi là giả, cái mà sẽ chuyển các giá trị của cột đơn thành cột đôi của 0 và 1, chỉ ra biến giả.